/************************************************************
 * Copyright (c) 2010 Georg Fritzsche
 *
 * This project is licensed under the "New BSD License": 
 * http://www.opensource.org/licenses/bsd-license.php
 ***********************************************************/

#ifndef TRIGGER_PLAYER_H
#define TRIGGER_PLAYER_H

#include <string>
#include <limits>
#include <vector>
#include <boost/integer_traits.hpp>
#include <boost/shared_ptr.hpp>

class Track;
class Config;
class AudioSystem;

namespace FMOD {
    class System;
}

class Player 
{
public:
    typedef std::size_t index_type;
    static const std::size_t index_no_track = boost::integer_traits<std::size_t>::const_max;
    typedef std::vector<boost::shared_ptr<Track> > TrackPtrVector;

public:
    Player(const boost::shared_ptr<AudioSystem>& system, const Config& config);
    ~Player();

    void reset();
    void next();

private:
    bool valid_index(index_type index) const;
    bool at_end(index_type index) const;
    void play(index_type index);
    void stop();

    TrackPtrVector m_tracks;
    index_type m_index;
};

#endif
